<div id="tiga_ba">
	<div id="tiga_baa">Data Catatan Kunjungan </div>
	<div id="tiga_bab">
		<a href="javascript:void(0)" onClick="location.href='utama.php?module=mod_ckunjungan&view=form_tambah'">
			<button class="button">Tambah</button>
		</a>
	</div>
	<div class="clear"></div>
</div>

<?php
	if(!empty($_GET['nama'])){
		$param_nama=$_GET['nama'];
	}else{
		$param_nama=$_POST['nama'];
	}
?>
<form method=post action='utama.php?module=mod_ckunjungan'>
	<table class="tbl_cari">
		<tr>
			<td width="65">Pencarian  : </td>
			<td width="200"><input type="text" name="nama" value="<?php echo $param_nama; ?>" class="input_field" /></td>
			<td><input name="submit" type="submit" class="button" value="Cari" /></td>
			<td></td>
			<!--<td align="right"><a href="module/mod_ckunjungan/cetak.php"><img src="asset/images/print.png" width="30"></a></td>-->
		</tr>
	</table>
</form>

<table class="tabel">
	<tr>
		<th>NO</th>
		<th>Aksi</th>
		<th>Catatan Kunjungan</th>
	</tr>
	<?php
		$p= new paging ;
		$batas= 10;

		//cek halaman dan posisi halaman
		$posisi = $p ->cariposisi($batas) ;
		$sql="select * from catatan_kunjungan where catatan_kunjungan like '%$param_nama%' order by id_catatan_kunjungan desc limit $posisi,$batas";
		//echo $sql;
		$qry=mysql_query($sql);
		$no=$posisi + 1;
		if(mysql_num_rows($qry)>0){
		
			while($hasil=mysql_fetch_array($qry)){
	?>
				<tr>
					<td align="center" width="30"><?php echo $no;?></td>
					<td align="center" align="center" width="60">
						<a href="utama.php?module=mod_ckunjungan&view=form_edit&id=<?php echo $hasil['id_catatan_kunjungan'];?>">
						<img src="asset/images/edit.png" title="Ubah Data"></a> 
						<?php hapus_data("$hasil[id_catatan_kunjungan]","id_catatan_kunjungan","id_catatan_kunjungan","catatan_kunjungan","jaminan","Catatan Kunjungan","mod_ckunjungan") ?>
					</td>
					<td ><?php echo $hasil['catatan_kunjungan'];?></td>
				</tr>
				
		<?php
				$no++;
			}
		}else{
		?>
	
	<tr>
		<td colspan="7" align="center">Data tidak Ada </td>
	</tr>
	
	<?php
		}
	?>
</table>

<?php
	$sql2="select * from catatan_kunjungan where catatan_kunjungan like '%$param_nama%'" ;
	$query2=mysql_query($sql2);
	$jumlah_data=mysql_num_rows($query2);
	//dapatkan jumlah halaman
	$jumlah_halaman= $p->jumlahhalaman($jumlah_data,$batas);
	//cetak link
	$linkhalaman=$p->navhalaman($_GET['halaman'],$jumlah_halaman,$_SERVER['PHP_SELF']."?module=mod_kelompok_kunjungan","nama=$param_nama");
	print($linkhalaman);
?>
        